package com.example.sxproject.controller;

import com.example.sxproject.pojo.User;
import com.example.sxproject.service.FinancialService;
import com.example.sxproject.service.UserService;
import jakarta.servlet.http.HttpSession;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.List;

@Controller
public class TestController {

    @Autowired
    private UserService userService;

    @RequestMapping("/test")//访问的路由
    public String test(HttpSession session) {
        List<User> users = userService.selectAll();
        User user = userService.findByPhone("15233409715");
        session.setAttribute("user", user);
        session.setAttribute("users", users);
        session.setAttribute("msg", "测试成功");// 把内容存到session中
        return "test"; //返回到test.html中
    }
}
